Is there a way to reduce a nested json by extracting only certain values